import { createStore } from 'vuex'


const store = createStore({
    state() {
        return {
            page:0,
            user:'',
            ava:'',
            isLogin:false,
        }
    },
    mutations: {
        AddPage(state,val=1){
            state.page+=val
            console.log('传进了',val)
        },
        SetPage(state,val=''){
            state.page=val
            console.log('传进了',val)
        },
        PvPage(state,val=1){
            if(state.page>0){
                state.page-=val
            }
        },
        GetUser(state,val=''){
            state.user=val
            console.log('传进了',val)
        },
        Getava(state,val=''){
            state.ava=val
            console.log('传进了',val)
        },
        ChangeLogin(state,val=false){
            state.isLogin=val
        }
    }
})
export { store }